{% for concept in search_results %} {# loop through the hits #}
<div class="concept-hit">
  <table class="search-result-header-table"><td>{% spaceless %}
	  {% if concept.foundBy %} {# hit has been found through an alternative label #}
      <span class="search-parameter-highlight"><span class="propertylabel">{{ concept.foundBy }}</span> {% if concept.ExVocab is defined %}<span class="conceptlabel redirected-vocab-id"> @{{ concept.ExVocab }}</span>{% endif %}
      <br />&nbsp;&nbsp;&#8627; <a class="propertyvaluelabel" href="{{ path_fix }}{{ concept.vocab }}/{{ lang }}/page/?uri={{ concept.uri }}">{{ concept.label }}</a></span>
	  {% else %}
      <span class="search-parameter-highlight{% if lang_count is not defined and rest != 1 %} propertylabel-pink">{{ concept.label }}
    {% elseif concept.vocab == vocab_id or not vocab_id is defined %}"> {# afo problem here has something to do with yso uris again #}
      <a class="conceptlabel" href="{{ path_fix }}{{ concept.vocab }}/{{ lang }}/page/?uri={{ concept.uri }}">{{ concept.label }}</a>
    {% else %}">
      <a class="conceptlabel" href="{{ path_fix }}{{ concept.vocab }}/{{ lang }}/page/?uri={{ concept.uri|url_encode() }}">{{ concept.label }}</a>
    {% endif %}
      {% if concept.vocab != vocab_id and concept.vocab != "" %}<span class="conceptlabel redirected-vocab-id"> @{{ concept.vocab }}</span>{% endif %}
      </span>
	  {% endif %}
    {% endspaceless %}</td><td>
    {% set typetrans = concept.type  %}
    <span class="propertyvalue concept-type-span" onmousemove="UpdatePosition(a);"
                            onmouseover="a = ShowContent('{{ typetrans }}', this);"
                            onmouseout="HideContent(a, this);">{% if typetrans != null %}{{ typetrans|trans }}{% endif %}</span>
    </td>
    </table>
	  <table class="search-results-property-table">
  	{% for propertyType in concept.properties %} {# loop through concept property types #}
      {% for property in propertyType %} {# looping the actual propertyDAO objects #}
        {% if loop.first %}<tr>
        {% set proptrans = property.type  %}
          <td><span class="propertyvaluelabel" onmousemove="UpdatePosition(a);"
                          onmouseover="a = ShowContent('{{ property.type }}', this);"
                          onmouseout="HideContent(a, this);">{{ proptrans|trans }}</span></td><td>{% endif %}
        {% if property.value == null %} {# more or less temporary fix for not displaying properties with missing labels #}
        {% elseif property.uri %}
          {% if property.type == 'skos:narrower' %}
            {% if property.exvocab == property.vocab %}
              <a class="propertyvalue" href="{{ path_fix }}{{ property.vocab }}/{{ lang }}/page/{{ property.uri }}">{{ property.value }}</a></br>
            {% else %}
              <a class="propertyvalue" href="{{ path_fix }}{{ vocab_id }}/{{ lang }}/page/?uri={{ property.uri|url_encode() }}">{{ property.value }}</a></br>
            {% endif %}
            {% if property.SubMembers %}<div class="subvalue"> {# if property is a group concept that has sub properties #}
              {% for sub_member in property.SubMembers %}
                <a class="propertyvalue" href="{{ path_fix }}{{ sub_member.vocab }}/{{ lang }}/page/?uri={{ sub_member.uri|url_encode() }}">{{ sub_member.value }}</a></br>                   
              {% endfor %}
              </div>
            {% endif %}
          {% elseif (propLabel != 'skos:exactMatch' and propLabel != 'skos:narrowMatch' and propLabel != 'skos:broadMatch') %}
            {% if property.exvocab == property.vocab %}
              <a class="propertyvalue" href="{{ path_fix }}{{ property.vocab }}/{{ lang }}/page/{{ property.uri }}">{{ property.value }}</a></br>
            {% else %}
              <a class="propertyvalue" href="{{ path_fix }}{{ property.exvocab }}/{{ lang }}/page/?uri={{ property.uri|url_encode() }}">{{ property.value }}</a>&nbsp@ {{ property.exvocab }}</br>
            {% endif %}
          {% else %}{# skos:exactMatch, skos:narrowMatch etc. #}
              {% if property.vocab != property.exvocab %} {# if the property is located in a another vocabulary #}
                <a class="propertyvalue" href="{{ path_fix }}{{ property.exvocab}}/{{ lang }}/page/?uri={{ property.uri|url_encode() }}">{{ property.value }}</a>
              {% else %}
                <a class="propertyvalue" href="{{ path_fix }}{{ property.vocab}}/{{ lang }}/page/{{ property.uri }}">{{ property.value }}</a>
              {% endif %}
            <span onmousemove="UpdatePosition(a);"
                  onmouseover="a = ShowContent('{{ property.exvocab_name }}', this);"
                  onmouseout="HideContent(a, this);">{% if property.lang != lang %} ({{ property.lang }}){% endif %} @ {{ property.exvocab }}</span></br>       
          {% endif %}
        {% else %} {# if no uri has been set eg. alternative labels as properties #}
          {% set propval = property.value %}
            <span class="propertyvalue">{{ propval|trans }}</span><br />
        {% endif %}
        {% if loop.last %}</div>{% endif %}
      {% endfor %}
            
        
    {% endfor %}
    {% if concept.ForeignLabels %}<tr><td><span class="propertyvaluelabel">{% trans %}onki:prefLabel{% endtrans %}</span></td><td>
      {% for lang,label in concept.ForeignLabels %}
        <span class="propertyvalue">{{ label }} ({{ lang }})</span>{% if not loop.last %}<br />{% endif %}
      {% endfor %}</td></tr>
    {% endif %}
    <tr><td><span class="propertyvaluelabel urilabel">URI:</span></td>
    <td><input readonly="true" onClick="this.select();" value="{{ concept.uri }}" class="propertyvalue uri-input-box"></td></tr>
    </table>
  <div class="bottomtext">
    <span class="header-text-small-font-nobold download-text">{% trans %}Lataa tämä käsite SKOS-muodossa:{% endtrans %} 
      <a onmousemove="UpdatePosition(a);" onmouseover="a = ShowContent('RDF/XML', this); return true;" onmouseout="HideContent(a, this);"
        href="{{ path_fix }}rest/concept?vocab={% if concept.vocab != "" %}{{ concept.vocab }}{% else %}{{ vocab.id }}{% endif %}&uri={{ concept.uri }}&format=application/rdf+xml">
        RDF/XML<img src="{{ path_fix }}resource/pics/download.png"></img></a>
    </span>
    <span class="header-text-small-font-nobold download-text">
      <a onmousemove="UpdatePosition(a);" onmouseover="a = ShowContent('TURTLE', this); return true;" onmouseout="HideContent(a, this);"
        href="{{ path_fix }}rest/concept?vocab={% if concept.vocab != "" %}{{ concept.vocab }}{% else %}{{ vocab.id }}{% endif %}&uri={{ concept.uri }}&format=text/turtle">
        TURTLE<img src="{{ path_fix }}resource/pics/download.png"></img></a>
    </span>
  </div>
</div>
{% endfor %}